<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../publics/jstl.jsp"%>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>管理后台登录</title>
    <link href="${ctx}/resource/publics/jquery-easyui-1.4.4/themes/default/easyui.css" rel="stylesheet" type="text/css">
    <link href="${ctx}/resource/publics/jquery-easyui-1.4.4/themes/icon.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="${ctx}/resource/publics/jquery-easyui-1.4.4/jquery.min.js"></script>
    <script type="text/javascript" src="${ctx}/resource/publics/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
</head>
<body style="text-align: center">
<form id="ff" method="post" action="${ctx}/manage/login/doLogin" style="text-align: left; width:334px; margin:auto;">
    <div style="margin-bottom: 10px;">
        <span>用户名：</span>
        <input id="username" name="username" class="easyui-textbox" data-options="iconCls:'icon-man'" style="height:30px;padding: 5px 10px 0 10px;">
    </div>
    <div style="margin-bottom: 10px;">
        <span>密　码：</span>
        <input id="password" name="password" class="easyui-textbox" data-options="iconCls:'icon-lock'" type="password" style="height:30px;padding: 5px 10px 0 10px;">
    </div>
    <div style="margin-bottom: 10px;">
        <span>验证码：</span>
        <input id="code" name="code" class="easyui-textbox" data-options="" value="" style="height:30px;width: 90px;">
        <img src="${ctx}/manage/kaptcha" onclick="this.src='${ctx}/manage/kaptcha?r=' + Math.random();"/>
    </div>
    <div>
        <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)"  onclick="submitForm()" style="width:80px">提交</a>
        <a class="easyui-linkbutton" data-options="iconCls:'icon-clear'" href="javascript:void(0)" onclick="clearForm()" style="width:80px">清空</a>
    </div>
</form>
<script type="text/javascript">
    var win = this.window;
    if(win != win.parent) {
        win.parent.location.href='${ctx}/manage/login/toLogin';
    }
    function submitForm() {
        $('#ff').submit();
    }
    function clearForm() {
        $('#ff').form('clear');
    }
    $(function(){
        var ret = ${result == null ? -1 : result.ret};
        if (ret != -1) {
            var tips = '${result == null ? 'undefined' : result.msg}';
            if (ret != 0) {
                ret = -1;
                $.messager.alert('提示', tips);
            }
        }
    });


    document.onkeydown=function(event){
         var e = event || window.event || arguments.callee.caller.arguments[0];
         if(e && e.keyCode == 13){ // enter
             submitForm()
         }
    };


</script>
</body>
</html>
